import React, { Component } from "react";
import { context } from "./App";

class Child extends Component {
  state = {};
  render() {
    return (
      <context.Consumer>
        {(value) => (
          <>
            <button onClick={value.minus}>-</button>
            <span>{value.count}</span>
            <button onClick={() => value.add(2)}>+2</button>
            <button onClick={() => value.add(3)}>+3</button>
          </>
        )}
      </context.Consumer>
    );
  }
}

export default Child;
